﻿using System;
using System.Configuration;

namespace AppFx.BizTalk.Diagnostics.Telemetry
{
    /// <summary>
    /// Configuration for the service bus instances
    /// </summary>
    public class TelemetryConfig : ConfigurationSection
    {
        public static TelemetryConfig Current
        {
            get
            {
                var current = ConfigurationManager.GetSection("appfx.biztalk.diagnostics.telemetry") as TelemetryConfig;
                if (current == null)
                {
                    throw new ApplicationException("The appfx.biztalk.diagnostics.telemetry configuration section has not been specified");
                }
                return current;
            }
        }

        /// <summary>
        /// The type for the default message handler if no other handler deals with the message
        /// </summary>
        [ConfigurationProperty("clients")]
        public TelemetryClientCollection Clients
        {
            get { return (TelemetryClientCollection)this[@"clients"]; }
        }
    }
}

